{extend name="default/base" /}

{block name="title"}注册会员{/block}

{block name="css"}{/block}

{block name="content"}
<div class="register-box">
  <div class="register-logo">
        注册会员
  </div>

  <div class="register-box-body">
    <p class="login-box-msg"></p>

    <form action="#" method="post">
      <div class="form-group has-feedback">
        <input type="text" class="form-control" name="username" placeholder="用户名">
        <span class="glyphicon glyphicon-user form-control-feedback"></span>
      </div>
      <div class="form-group has-feedback">
        <input type="email" class="form-control" name="email" placeholder="邮箱">
        <span class="glyphicon glyphicon-envelope form-control-feedback"></span>
      </div>
      <div class="form-group has-feedback">
        <input type="password" class="form-control" name="password" placeholder="密码">
        <span class="glyphicon glyphicon-lock form-control-feedback"></span>
      </div>
      <div class="form-group has-feedback">
        <input type="password" class="form-control" name="re_password" placeholder="确认密码">
        <span class="glyphicon glyphicon-log-in form-control-feedback"></span>
      </div>
      <div class="row">
        <div class="col-xs-6">
          <a href="" class="btn btn-default btn-block btn-flat">登陆</a>
        </div>
        <!-- /.col -->
        <div class="col-xs-6">
          <button type="button" id="submit" class="btn btn-primary btn-block btn-flat">注册</button>
        </div>
        <!-- /.col -->
      </div>
    </form>
  </div>
  <!-- /.form-box -->
</div>
<!-- /.register-box -->

{/block}

{block name="js"}
<script>
$("#submit").click(function(){
    $user = 
    $.ajax({
        type:'post',
        url: "{:url('api/passport/register')}",
        data: $('form').serialize(),
        success: function(r){
            if(r.code == 200){
                $(".login-box-msg").html('<span class="text-blue">'+r.msg+'</span>');
                window.location.href=r.redirect;
            } else {
                $(".login-box-msg").html('<span class="text-red">'+r.msg+'</span>');
            }
        }
    });
});

</script> 
{/block}